package com.ctg.behavior.client.impala.config;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ctg.behavior.client.impala.config.CtImpalaConfig.MockData;

import lombok.Data;

@Data
@Component
public class CtImpalaMockData {

	@Autowired
	private CtImpalaConfig impalaConfig;

	public Map<String, List<Map<String, Object>>> mockDatas = new HashMap<>();

	@PostConstruct
	public void initMockData() {
		
		List<MockData> mockDataList = impalaConfig.getMockDatas();
		for(MockData item : mockDataList) {
			String key = item.getMockKey();
			List<Map<String, Object>> values = item.getValues();
			if(null == values || values.isEmpty()) {
				continue;
			}
			mockDatas.put(key, values);
		}
		
	}

}
